



** only do once:
* shp2dta using OrigData/postcodeshape/POA_2016_AUST.shp, database(Data/POA) coordinates(Data/poa_coord) genid(id) gencentroids(centroid)

use Data/POA.dta, clear


rename POA_CODE16 postcode 

rename AREA areapostcode

keep postcode area id

destring postcode, replace
destring area, replace


save Data/PostcodeArea.dta, replace



use Data/POA.dta, clear

destring POA_CODE16, replace

keep if POA_CODE16 > 2999 & POA_CODE16 <4000

nearest x_centroid y_centroid, dist(distvar) id(neighboridvar)

gen index_neighbor = _n

 geodist  y_centroid x_centroid  -37.8124 144.9626  , generate(GPO_distance) 

 rename POA_CODE16 postcode 
 
 save Data/Postcode_matching.dta, replace
